//
//  USChatThemeColorCell.m
//  us
//
//  Created by karry on 2025/4/12.
//

#import "USChatThemeColorCell.h"

@implementation USChatThemeColorCell


-(instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self initialization];
    }
    return self;
}

-(void)initialization{
    
    [self bgView];
    [self themeColorView];
    
    [self themeImgView];
    self.themeImgView.hidden = YES;
}

- (void)setSelected:(BOOL)selected{
    [super setSelected:selected];

    if (selected) {
        self.bgView.layer.borderColor = UIColor.brightBorderColor.CGColor;
    }else {
        self.bgView.layer.borderColor = UIColor.borderColor.CGColor;
    }
}
- (UIView *)bgView {
    if (_bgView == nil) {
        _bgView = [[UIView alloc]init];
        _bgView.layer.masksToBounds = YES;
        _bgView.layer.cornerRadius = 14;
        _bgView.layer.borderWidth = 3;
        _bgView.layer.borderColor = UIColor.borderColor.CGColor;
        [self.contentView addSubview:_bgView];
        [_bgView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.edges.equalTo(self.contentView);
        }];
    }
    return  _bgView;
}
-(UIView *)themeColorView{
    if (!_themeColorView) {
        _themeColorView = [[UIView alloc]init];
        _themeColorView.layer.cornerRadius = 12;
         [self.bgView addSubview:_themeColorView];
          [_themeColorView mas_makeConstraints:^(MASConstraintMaker *make) {
              make.top.equalTo(self.bgView).offset(4);
              make.left.equalTo(self.bgView).offset(4);
              make.right.equalTo(self.bgView).offset(-4);
              make.bottom.equalTo(self.bgView).offset(-4);

        }];
    }
    return _themeColorView;
}
-(UIImageView *)themeImgView{
    if (!_themeImgView) {
        _themeImgView = [[UIImageView alloc]init];
        _themeImgView.layer.cornerRadius = 12;
         [self.bgView addSubview:_themeImgView];
          [_themeImgView mas_makeConstraints:^(MASConstraintMaker *make) {
              make.top.equalTo(self.bgView).offset(4);
              make.left.equalTo(self.bgView).offset(4);
              make.right.equalTo(self.bgView).offset(-4);
              make.bottom.equalTo(self.bgView).offset(-4);

        }];
    }
    return _themeImgView;
}
@end
